$(document).ready(function () {

  //预加载
  var oLocaWarp = document.querySelector(".jzwarp");
  document.onreadystatechange = onreadystatechange;
  // load();
  function onreadystatechange() {
    if (document.readyState === "complete") {
      oLocaWarp.classList.add('loaded');
    }
  }


  var dongArr = [],
    sssss = [],
    nDongArr = [];
  var nrTopList = document.querySelectorAll('.nrtop'),
    nrTopList1 = document.querySelectorAll('.nrtop1'),
    nrTopListw = document.querySelector('.nrtopw'),
    // nrBigwarp = document.querySelector('.bigwarp'),
    oSlidewarp = document.querySelector('.slidewarp');
  var ydClintWidth1 = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
  //   nrBigwarp.style.width = ydClintWidth1 + "px";
  /*获取浏览器可视屏幕的高度*/
  var windowHeight = parseInt(window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight);
  if (windowHeight < 600) {
    gunjuli(dongArr, nrTopList, gundTop);
  }
  for (let i = 0; i < nrTopList.length; i++) {
    dongArr.push(nrTopList[i].offsetTop);
  }
  for (let j = 0; j < nrTopList1.length; j++) {
    var nr9Offset = parseInt((nrTopListw.offsetTop) + (nrTopList1[j].offsetTop));
    nDongArr.push(nr9Offset);
  }
  if (ydClintWidth1 < 600) {
    if ((dongArr[0] - windowHeight) <= -20) {
      nrTopList[0].classList.add('active');
    }
  }

  function gunjuli(a, b, d) {
    for (let i = 0; i < a.length; i++) {
      if (((a[i] - windowHeight) - d) <= -20) {
        b[i].classList.add('active');
      }
    }
  }
  window.onscroll = function () {
    /*获取滚动距离*/
    var gundTop = parseInt(document.documentElement.scrollTop || document.body.scrollTop);
    gunjuli(dongArr, nrTopList, gundTop);
    gunjuli(nDongArr, nrTopList1, gundTop);

  }

  /**移动端幻灯片 */
  function slide() {
    /**获取浏览器宽度 */
    var ydClintWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;

    //幻灯片高度
    var warpHeight = parseInt((ydClintWidth * 900) / 1920);
    $('.slidewarp').css({
      "height": warpHeight + "px"
    });
    oSlidewarp.style.width = (ydClintWidth) + "px";
    // nrBigwarp.style.width = ydClintWidth + "px";

  }
  slide();
  window.onresize = function () {
    slide();
  }

  /*手机端导航 */

  $('.sjnavline').click(function () {
    $('.navwarp-ph').show(300);
  });

  $('.navwarp-phclose').click(function () {
    $('.navwarp-ph').hide(300);
  });

  $('.navwarp-ph ul li').click(function () {
    $('.navwarp-ph').hide(300);
  });















}) //加载完成
